<!-- 角色选择下拉框 -->
<template>
  <el-select clearable
             :value="value"
             class="ele-block"
             :placeholder="placeholder"
             no-match-text='全部店铺'
             :disabled="value==0?true: false"
             @input="updateValue">
    <el-option v-for="item in data"
              
               :key="item.id"
               :value="item.id?item.id:'全部门店'"
               :label="item.name?item.name:'全部门店'" />
  </el-select>
</template>

<script>
import { listStore } from '@/api/system/store';

export default {
  props: {
    // 选中的数据(v-modal)
    value: [Number, String],
    // 提示信息
    placeholder: {
      type: String,
      default: '请选择门店'
    }
  },
  data () {
    return {
      data: []
    };
  },
  created () {

    listStore()
      .then((list) => {
        console.log(list)
        this.data = list.list;
      })
      .catch((e) => {
        this.$message.error(e.message);
      });
  },
  methods: {
    updateValue (value) {
      this.$emit('input', value);
    }
  }
};
</script>
